var a = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../@babel/runtime/regenerator")), t = require("../../../@babel/runtime/helpers/asyncToGenerator"), e = getApp();

Page({
    data: {
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        weekMessage: []
    },
    onLoad: function(a) {
        wx.setNavigationBarTitle({
            title: "审核通知"
        }), this.getListData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    gotoPages: function(a) {
        var t = a.currentTarget.dataset.page, e = a.currentTarget.dataset.item;
        if ("" != t && null != t) {
            var s = e.msg_body.apply_id;
            wx.navigateTo({
                url: t + "?id=" + s
            });
        }
    },
    onShareAppMessage: function() {},
    initData: function() {
        this.data.page = 1, this.data.isLoadMore = !0, this.data.total_page = 0;
    },
    getListData: function() {
        var s = this;
        return t(a.default.mark(function t() {
            var i;
            return a.default.wrap(function(a) {
                for (;;) switch (a.prev = a.next) {
                  case 0:
                    s.initData(), i = e.getNetAddresss("plugin.instation-message.api.message.get-type-list"), 
                    e._postNetWork({
                        url: i,
                        data: {
                            type_id: 10
                        },
                        success: function(a) {
                            var t = a.data;
                            if (1 !== t.result) return s.tips(t.msg);
                            s.data.isLoadMore = !0, s.data.total_page = t.data.last_page, s.data.total_page || (s.data.total_page = 0), 
                            s.setData({
                                weekMessage: t.data.data
                            });
                        }
                    });

                  case 3:
                  case "end":
                    return a.stop();
                }
            }, t);
        }))();
    },
    _getMoreData: function() {
        var a = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var t = e.getNetAddresss("plugin.instation-message.api.message.get-type-list");
            e._postNetWork({
                url: t,
                data: {
                    type_id: 10,
                    page: this.data.page
                },
                success: function(t) {
                    var e = t.data;
                    if (a.data.isLoadMore = !0, 1 === e.result) {
                        var s = e.data.data, i = a.data.weekMessage.concat(s);
                        a.setData({
                            weekMessage: i
                        });
                    } else a.data.page = a.data.page - 1, a.data.isLoadMore = !1;
                }
            });
        }
    },
    tips: function(a) {
        return wx.showToast({
            title: a,
            icon: "none",
            duration: 2e3
        }), !1;
    }
});